package xml.others;

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

import xml.uidElements.PosCondition;
import xml.uidElements.PreCondition;
import xml.uidElements.Text;
import xml.uidElements.TextualNote;
import xml.uidElements.UID;
import xml.uidElements.entry.DataItem;
import xml.uidElements.entry.DataItemSet;
import xml.uidElements.entry.EnumeratedData;
import xml.uidElements.entry.EnumeratedOption;
import xml.uidElements.entry.ORDataEntry;
import xml.uidElements.entry.OptionalDataItem;
import xml.uidElements.entry.Structure;
import xml.uidElements.entry.StructureSet;
import xml.uidElements.entry.SubState;
import xml.uidElements.entry.XORDataEntry;
import xml.uidElements.output.OutputDataItem;
import xml.uidElements.output.OutputDataItemSet;
import xml.uidElements.output.OutputStructure;
import xml.uidElements.output.OutputStructureSet;

public class FacadeConstructorUID {

	private Vector<UID> setUIDs;
	static FacadeConstructorUID instance;

	// private static Ids ids = new Ids();

	private FacadeConstructorUID() {
		setUIDs = new Vector<UID>();
		// ids = new Ids();
	}

	public static FacadeConstructorUID getInstance() {
		if (instance == null)
			instance = new FacadeConstructorUID();
		return instance;
	}

	public static void removeInstance() {
		instance = null;
	}

	/**
	 * Cria um novo UID se nao existir nenhum outro UID com id passado como
	 * parametro.
	 */
	public void newUID(String idUID, String name) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID))
				throw new UIDException(UIDException.EXISTING_UID,
						"There is an UID with this name");
		}
		uid = new UID(idUID, name);
		this.setUIDs.add(uid);
	}

	/**
	 * Insere o estado inicial com idInitialState ao UID com identificador igual
	 * ao idUID.
	 */
	public void insertInitialState(String idUID, String idInitialState) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertInitialState(idInitialState);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");
	}

	/**
	 * Insere um novo estado de intera��o com idState ao UID com identificador
	 * igual ao idUID.
	 */
	public void insertState(String idUID, String idState) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertState(idState);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	// EU FIZ AGORA...

	/**
	 * Insere uma nova chamada de UID com idUIDCall ao UID com identificador
	 * igual ao idUID.
	 */
	public void insertUIDCall(String idUID, String idUIDCall, String name) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertUIDCall(idUIDCall, name);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	// INPUTs:

	/**
	 * Insere um item de dado, com name e domain, fornecido pelo usuario em um
	 * UID com idUID. Se domain for null, nao sera' atribuido dominio para o
	 * item de dado.
	 */
	public void insertInputDataItem(String idUID, String idState, String name,
			String domain) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				DataItem dataItem;
				// if (domain == null)
				// dataItem = new DataItem(ids.getId("dataitem").toString(),
				// name);
				// else
				// dataItem = new DataItem(ids.getId("dataitem").toString(),
				// name,
				// domain);
				dataItem = new DataItem(name, domain);
				uid.insertInputDataItem(idState, dataItem);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	/**
	 * Insere um item de dado OPCIONAL, com name e domain, fornecido pelo
	 * usuario em um UID com idUID. Se domain for null, nao sera' atribuido
	 * dominio para o item de dado.
	 */
	public void insertInputOptionalDataItem(String idUID, String idState,
			String name, String domain) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				OptionalDataItem dataItem;
				// if (domain == null)
				// dataItem = new OptionalDataItem(ids.getId(
				// "optionaldataitem").toString(), name);
				// else
				// dataItem = new OptionalDataItem(ids.getId("optionaldataitem")
				// .toString(), name, domain);
				dataItem = new OptionalDataItem(name, domain);

				uid.insertInputDataItem(idState, dataItem);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");
	}

	/**
	 * Insere um conjunto de itens de dados, com name e domain, fornecido pelo
	 * usuario em um UID com idUID. Se domain for null, nao sera' atribuido
	 * dominio para o item de dado.
	 */
	public void insertInputSetDataItem(String idUID, String idState,
			String name, String domain, int cardinalityMin, int cardinalityMax) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				DataItemSet dataItem;
				// if (domain == null)
				// dataItem = new DataItemSet(name);
				// else
				// dataItem = new
				// DataItemSet(ids.getId("dataitemset").toString(),
				// name, domain);
				dataItem = new DataItemSet(name, domain);
				dataItem.setCardinality(cardinalityMin, cardinalityMax);
				uid.insertInputDataItem(idState, dataItem);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");
	}

	/**
	 * Insere uma estrutura, com name e output-structure-elements, fornecida
	 * pelo usuario em um UID com idUID.
	 */
	public void insertInputStructure(String idUID, String idState, String name,
			String data) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				// Structure structure = new
				// Structure(ids.getId("structure").toString(), name, data);
				Structure structure = new Structure(name, data);
				structure.setOptional(false);

				uid.insertInputStructure(idState, structure);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");
	}

	/**
	 * Insere uma estrutura OPCIONAL, com name e output-structure-elements,
	 * fornecida pelo usuario em um UID com idUID.
	 */
	public void insertInputOptionalStructure(String idUID, String idState,
			String name, String data) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				// Structure structure = new
				// Structure(ids.getId("structure").toString(), name, data);
				Structure structure = new Structure(name, data);
				structure.setOptional(true);
				uid.insertInputStructure(idState, structure);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");
	}

	/**
	 * Insere uma estrutura, com name, fornecida pelo usuario em um UID com
	 * idUID.
	 */
	public void insertInputSetStructure(String idUID, String idState,
			String name, String data, int cardinalityMin, int cardinalityMax) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				// StructureSet structure = new
				// StructureSet(ids.getId("structureset").toString(), name,
				// data);
				StructureSet structure = new StructureSet(name, data);
				structure.setOptional(false);
				structure.setCardinality(cardinalityMin, cardinalityMax);
				uid.insertInputStructure(idState, structure);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");
	}

	/**
	 * Insere uma pre-condicao no UID com idUID.
	 */
	public void insertPreCondition(String idUID, String condition) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertPreCondition(new PreCondition(condition));
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	/**
	 * Insere uma pos-condicao no UID com idUID.
	 */
	public void insertPosCondition(String idUID, String condition) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertPosCondition(new PosCondition(condition));
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	/**
	 * Insere uma textual-note no UID com idUID.
	 */
	public void insertTextualNote(String idUID, String note) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTextualNote(new TextualNote(note));
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public UID getUID(String idUID) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID))
				return uid;

		}
		return null;
	}

	public void insertOutputSetDataItem(String idUID, String idState,
			String name, String domain, int cardinalityMin, int cardinalityMax) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				OutputDataItemSet dataItem;
				// if (domain == null)
				// dataItem = new OutputDataItemSet(name);
				// else
				dataItem = new OutputDataItemSet(name, domain);
				dataItem.setCardinality(cardinalityMin, cardinalityMax);
				uid.insertOutputDataItem(idState, dataItem);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertOutputDataItem(String idUID, String idState, String name,
			String domain) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				OutputDataItem dataItem;
				// if (domain == null)
				// dataItem = new OutputDataItem(name);
				// else
				dataItem = new OutputDataItem(name, domain);
				uid.insertOutputDataItem(idState, dataItem);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertOutputSetStructure(String idUID, String idState,
			String name, String data, int cardinalityMin, int cardinalityMax) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				OutputStructureSet structure = new OutputStructureSet(name,
						data);
				structure.setCardinality(cardinalityMin, cardinalityMax);
				uid.insertOutputStructure(idState, structure);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertOutputStructure(String idUID, String idState,
			String name, String data) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				OutputStructure structure = new OutputStructure(name, data);

				uid.insertOutputStructure(idState, structure);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");
	}

	public void insertInputEnumeratedData(String idUID, String idState,
			String name, String options, Integer cardinalityMin,
			Integer cardinalityMax) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				List<EnumeratedOption> listOptions = new ArrayList<EnumeratedOption>();

//				String[] a = options.replaceAll(" ", "").split(",");
				String[] a = options.split(",");

				for (String s : a) {
					if (!a.equals("")) {
						listOptions.add(new EnumeratedOption(s));
					}
				}

				EnumeratedData enumeratedData = new EnumeratedData(name,
						listOptions, cardinalityMin, cardinalityMax);
				uid.insertInputEnumeratedData(idState, enumeratedData);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertInputXORDataEntry(String idUID, String idState,
			String idDataItem1, String nameDataItem1, String domainDataItem1,
			String idDataItem2, String nameDataItem2, String domainDataItem2) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				uid.insertInputXORDataEntry(idState, new XORDataEntry(
						// new DataItem(idDataItem1, nameDataItem1,
						// domainDataItem1), new DataItem(idDataItem2,
						// nameDataItem2, domainDataItem2)));
						new DataItem(nameDataItem1, domainDataItem1),
						new DataItem(nameDataItem2, domainDataItem2)));
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertInputORDataEntry(String idUID, String idState,
			String idDataItem1, String nameDataItem1, String domainDataItem1,
			String idDataItem2, String nameDataItem2, String domainDataItem2) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				uid.insertInputORDataEntry(idState, new ORDataEntry(
						// new DataItem(idDataItem1, nameDataItem1,
						// domainDataItem1), new DataItem(idDataItem2,
						// nameDataItem2, domainDataItem2)));
						new DataItem(nameDataItem1, domainDataItem1),
						new DataItem(nameDataItem2, domainDataItem2)));
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertOptionalInputEnumeratedData(String idUID, String idState,
			String name, String options, Integer cardinalityMin,
			Integer cardinalityMax) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				List<EnumeratedOption> listOptions = new ArrayList<EnumeratedOption>();

//				String[] a = options.replaceAll(" ", "").split(",");
				String[] a = options.split(",");

				for (String s : a) {
					if (!a.equals("")) {
						listOptions.add(new EnumeratedOption(s));
					}
				}

				EnumeratedData enumeratedData = new EnumeratedData(name,
						listOptions, cardinalityMin, cardinalityMax);
				enumeratedData.setOptional(true);
				uid.insertInputEnumeratedData(idState, enumeratedData);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertSubState(String idUID, String idState, String id) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				SubState subState = new SubState(id);

				uid.insertSubState(idState, subState);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertOutputDataItemInSubState(String idUID, String idState,
			String idSubState, String name, String domain) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				OutputDataItem dataItem;
				// if (domain == null)
				// dataItem = new OutputDataItem(name);
				// else
				dataItem = new OutputDataItem(name, domain);
				uid.insertOutputDataItemInSubState(idState, idSubState,
						dataItem);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertOutputSetDataItemInSubState(String idUID, String idState,
			String idSubState, String name, String domain, int cardinalityMin,
			int cardinalityMax) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				OutputDataItemSet dataItem;
				// if (domain == null)
				// dataItem = new OutputDataItemSet(name);
				// else
				dataItem = new OutputDataItemSet(name, domain);
				dataItem.setCardinality(cardinalityMin, cardinalityMax);
				uid.insertOutputDataItemInSubState(idState, idSubState,
						dataItem);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertInputSetDataItemInSubState(String idUID, String idState,
			String idSubState, String name, String domain, int cardinalityMin,
			int cardinalityMax) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				DataItemSet dataItem;
				// if (domain == null)
				// dataItem = new DataItemSet(name);
				// else
				// dataItem = new
				// DataItemSet(ids.getId("dataitemset").toString(),
				// name, domain);
				dataItem = new DataItemSet(name, domain);
				dataItem.setCardinality(cardinalityMin, cardinalityMax);
				uid.insertInputDataItemInSubState(idState, idSubState, dataItem);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertInputDataItemInSubState(String idUID, String idState,
			String idSubState, String name, String domain) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				DataItemSet dataItem;
				// if (domain == null)
				// dataItem = new DataItemSet(name);
				// else
				// dataItem = new
				// DataItemSet(ids.getId("dataitemset").toString(),
				// name, domain);
				dataItem = new DataItemSet(name, domain);
				uid.insertInputDataItemInSubState(idState, idSubState, dataItem);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertInputEnumeratedDataInSubState(String idUID,
			String idState, String idSubState, String name, String options,
			Integer cardinalityMin, Integer cardinalityMax) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				List<EnumeratedOption> listOptions = new ArrayList<EnumeratedOption>();

//				String[] a = options.replaceAll(" ", "").split(",");
				String[] a = options.split(",");

				for (String s : a) {
					if (!a.equals("")) {
						listOptions.add(new EnumeratedOption(s));
					}
				}

				EnumeratedData enumeratedData = new EnumeratedData(name,
						listOptions, cardinalityMin, cardinalityMax);
				uid.insertInputEnumeratedDataInSubState(idState, idSubState,
						enumeratedData);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertInputXORDataEntryInSubState(String idUID, String idState,
			String idSubState, String idDataItem1, String nameDataItem1,
			String domainDataItem1, String idDataItem2, String nameDataItem2,
			String domainDataItem2) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				uid.insertInputXORDataEntryInSubState(idState, idSubState,
				// new XORDataEntry(new DataItem(idDataItem1,
				// nameDataItem1, domainDataItem1), new DataItem(
				// idDataItem2, nameDataItem2, domainDataItem2)));
						new XORDataEntry(new DataItem(nameDataItem1,
								domainDataItem1), new DataItem(nameDataItem2,
								domainDataItem2)));
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertInputORDataEntryInSubState(String idUID, String idState,
			String idSubState, String idDataItem1, String nameDataItem1,
			String domainDataItem1, String idDataItem2, String nameDataItem2,
			String domainDataItem2) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				uid.insertInputORDataEntryInSubState(idState, idSubState,
				// new ORDataEntry(new DataItem(idDataItem1,
				// nameDataItem1, domainDataItem1), new DataItem(
				// idDataItem2, nameDataItem2, domainDataItem2)));
						new ORDataEntry(new DataItem(nameDataItem1,
								domainDataItem1), new DataItem(nameDataItem2,
								domainDataItem2)));
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertInputOptionalDataItemInSubState(String idUID,
			String idState, String idSubState, String name, String domain) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				OptionalDataItem dataItem;
				// if (domain == null)
				// dataItem = new OptionalDataItem(ids.getId(
				// "optionaldataitem").toString(), name);
				// else
				// dataItem = new OptionalDataItem(ids.getId("optionaldataitem")
				// .toString(), name, domain);
				dataItem = new OptionalDataItem(name, domain);

				uid.insertInputDataItemInSubState(idState, idSubState, dataItem);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertOptionalInputEnumeratedDataInSubState(String idUID,
			String idState, String idSubState, String name, String options,
			Integer cardinalityMin, Integer cardinalityMax) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				List<EnumeratedOption> listOptions = new ArrayList<EnumeratedOption>();

//				String[] a = options.replaceAll(" ", "").split(",");
				String[] a = options.split(",");

				for (String s : a) {
					if (!a.equals("")) {
						listOptions.add(new EnumeratedOption(s));
					}
				}

				EnumeratedData enumeratedData = new EnumeratedData(name,
						listOptions, cardinalityMin, cardinalityMax);
				enumeratedData.setOptional(true);
				uid.insertInputEnumeratedDataInSubState(idState, idSubState,
						enumeratedData);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertInputOptionalStructureInSubState(String idUID,
			String idState, String idSubState, String name, String data) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				// Structure structure = new
				// Structure(ids.getId("structure").toString(), name, data);
				Structure structure = new Structure(name, data);
				structure.setOptional(true);
				uid.insertInputStructureInSubState(idState, idSubState,
						structure);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertOutputSetStructureInSubState(String idUID,
			String idState, String idSubState, String name, String data,
			int cardinalityMin, int cardinalityMax) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				OutputStructureSet structure = new OutputStructureSet(name,
						data);
				structure.setCardinality(cardinalityMin, cardinalityMax);
				uid.insertOutputStructureInSubState(idState, idSubState,
						structure);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertOutputStructureInSubState(String idUID, String idState,
			String idSubState, String name, String data) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				OutputStructure structure = new OutputStructure(name, data);

				uid.insertOutputStructureInSubState(idState, idSubState,
						structure);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");
	}

	public void insertInputSetStructureInSubState(String idUID, String idState,
			String idSubState, String name, String data, int cardinalityMin,
			int cardinalityMax) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				// StructureSet structure = new
				// StructureSet(ids.getId("structureset").toString(), name,
				// data);
				StructureSet structure = new StructureSet(name, data);
				structure.setOptional(false);
				structure.setCardinality(cardinalityMin, cardinalityMax);
				uid.insertInputStructureInSubState(idState, idSubState,
						structure);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertInputStructureInSubState(String idUID, String idState,
			String idSubState, String name, String data) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				// Structure structure = new
				// Structure(ids.getId("structure").toString(), name, data);
				Structure structure = new Structure(name, data);
				structure.setOptional(false);
				uid.insertInputStructureInSubState(idState, idSubState,
						structure);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertText(String idUID, String idState, String id, String data) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				Text text = new Text(id, data);

				uid.insertText(idState, text);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertTextInSubState(String idUID, String idState,
			String idSubState, String id, String data) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				Text text = new Text(id, data);

				uid.insertTextInSubState(idState, idSubState, text);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertInputOptionalSetDataItem(String idUID, String idState,
			String name, String domain, int cardinalityMin, int cardinalityMax) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				DataItemSet dataItem;
				// if (domain == null)
				// dataItem = new DataItemSet(name);
				// else
				// dataItem = new
				// DataItemSet(ids.getId("dataitemset").toString(),
				// name, domain);
				dataItem = new DataItemSet(name, domain);
				dataItem.setCardinality(cardinalityMin, cardinalityMax);
				dataItem.setOptional(true);
				uid.insertInputDataItem(idState, dataItem);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");
	}

	public void insertInputOptionalSetStructure(String idUID, String idState,
			String name, String data, int cardinalityMin, int cardinalityMax) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				// StructureSet structure = new
				// StructureSet(ids.getId("structureset").toString(), name,
				// data);
				StructureSet structure = new StructureSet(name, data);
				structure.setOptional(true);
				structure.setCardinality(cardinalityMin, cardinalityMax);
				uid.insertInputStructure(idState, structure);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");
	}

	public void insertInputOptionalSetStructureInSubState(String idUID,
			String idState, String idSubState, String name, String data,
			int cardinalityMin, int cardinalityMax) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {

				// StructureSet structure = new StructureSet(ids.getId(
				// "structureset").toString(), name, data);
				StructureSet structure = new StructureSet(name, data);
				structure.setOptional(true);
				structure.setCardinality(cardinalityMin, cardinalityMax);
				uid.insertInputStructureInSubState(idState, idSubState,
						structure);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	public void insertInputOptionalSetDataItemInSubState(String idUID,
			String idState, String idSubState, String name, String domain,
			int cardinalityMin, int cardinalityMax) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				DataItemSet dataItem;
				// if (domain == null)
				// dataItem = new DataItemSet(name);
				// else
				// dataItem = new
				// DataItemSet(ids.getId("dataitemset").toString(),
				// name, domain);
				dataItem = new DataItemSet(name, domain);
				dataItem.setCardinality(cardinalityMin, cardinalityMax);
				dataItem.setOptional(true);
				uid.insertInputDataItemInSubState(idState, idSubState, dataItem);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this name");

	}

	// TRANSITION TO STATE

	/**
	 * Insere uma transicao, com idTransition, em um UID com idUID com origem no
	 * estado idSourceState e destino no estado idTargetState.
	 */

	public void insertTransitionFromStateToState(String idUID,
			String idSourceState, String idTargetState, String idTransition,
			String condition, String option) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromStateToState(idSourceState,
						idTargetState, idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionFromSubStateToState(String idUID,
			String idSourceState, String idSourceSubState,
			String idTargetState, String idTransition, String condition,
			String option) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromSubStateToState(idSourceState,
						idSourceSubState, idTargetState, idTransition,
						condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionFromDataItemToState(String idUID,
			String idSourceState, String idSourceDataItem,
			String idTargetState, String idTransition, String condition,
			String option) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromDataItemToState(idSourceState,
						idSourceDataItem, idTargetState, idTransition,
						condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionFromStructureToState(String idUID,
			String idSourceState, String idSourceStructure,
			String idTargetState, String idTransition, String condition,
			String option) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromStructureToState(idSourceState,
						idSourceStructure, idTargetState, idTransition,
						condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionFromDataItemInSubStateToState(String idUID,
			String idSourceState, String idSourceSubState,
			String idSourceDataItem, String idTargetState, String idTransition,
			String condition, String option) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromDataItemInSubStateToState(
						idSourceState, idSourceSubState, idSourceDataItem,
						idTargetState, idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionFromStructureInSubStateToState(String idUID,
			String idSourceState, String idSourceSubState,
			String idSourceStructure, String idTargetState,
			String idTransition, String condition, String option) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromStructureInSubStateToState(
						idSourceState, idSourceSubState, idSourceStructure,
						idTargetState, idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	// TRANSITION NO RETURNABLE TO STATE

	/**
	 * Insere uma transicao, com idTransition, em um UID com idUID com origem no
	 * estado idSourceState e destino no estado idTargetState.
	 */
	public void insertTransitionNoReturnableFromStateToState(String idUID,
			String idSourceState, String idTargetState, String idTransition,
			String condition, String option) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromStateToState(idSourceState,
						idTargetState, idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionNoReturnableFromSubStateToState(String idUID,
			String idSourceState, String idSourceSubState,
			String idTargetState, String idTransition, String condition,
			String option) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromSubStateToState(
						idSourceState, idSourceSubState, idTargetState,
						idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionNoReturnableFromDataItemToState(String idUID,
			String idSourceState, String idSourceDataItem,
			String idTargetState, String idTransition, String condition,
			String option) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromDataItemToState(
						idSourceState, idSourceDataItem, idTargetState,
						idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionNoReturnableFromStructureToState(String idUID,
			String idSourceState, String idSourceStructure,
			String idTargetState, String idTransition, String condition,
			String option) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromStructureToState(
						idSourceState, idSourceStructure, idTargetState,
						idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionNoReturnableFromDataItemInSubStateToState(
			String idUID, String idSourceState, String idSourceSubState,
			String idSourceDataItem, String idTargetState, String idTransition,
			String condition, String option) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromDataItemInSubStateToState(
						idSourceState, idSourceSubState, idSourceDataItem,
						idTargetState, idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionNoReturnableFromStructureInSubStateToState(
			String idUID, String idSourceState, String idSourceSubState,
			String idSourceStructure, String idTargetState,
			String idTransition, String condition, String option) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromStructureInSubStateToState(
						idSourceState, idSourceSubState, idSourceStructure,
						idTargetState, idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	// TRANSITION FROM SET TO STATE
	public void insertTransitionFromSetDataItemToState(String idUID,
			String idSourceState, String idSourceDataItem,
			String idTargetState, String idTransition, String condition,
			String option, int number) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromSetDataItemToState(idSourceState,
						idSourceDataItem, idTargetState, idTransition,
						condition, option, number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionFromSetStructureToState(String idUID,
			String idSourceState, String idSourceStructure,
			String idTargetState, String idTransition, String condition,
			String option, int number) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromSetStructureToState(idSourceState,
						idSourceStructure, idTargetState, idTransition,
						condition, option, number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionFromSetDataItemInSubStateToState(String idUID,
			String idSourceState, String idSourceSubState,
			String idSourceDataItem, String idTargetState, String idTransition,
			String condition, String option, int number) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromSetDataItemInSubStateToState(
						idSourceState, idSourceSubState, idSourceDataItem,
						idTargetState, idTransition, condition, option, number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionFromSetStructureInSubStateToState(String idUID,
			String idSourceState, String idSourceSubState,
			String idSourceStructure, String idTargetState,
			String idTransition, String condition, String option, int number) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromSetStructureInSubStateToState(
						idSourceState, idSourceSubState, idSourceStructure,
						idTargetState, idTransition, condition, option, number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	// TRANSITION NO RETURNABLE FROM SET TO STATE
	public void insertTransitionNoReturnableFromSetDataItemToState(
			String idUID, String idSourceState, String idSourceDataItem,
			String idTargetState, String idTransition, String condition,
			String option, int number) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromSetDataItemToState(
						idSourceState, idSourceDataItem, idTargetState,
						idTransition, condition, option, number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionNoReturnableFromSetStructureToState(
			String idUID, String idSourceState, String idSourceStructure,
			String idTargetState, String idTransition, String condition,
			String option, int number) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromSetStructureToState(
						idSourceState, idSourceStructure, idTargetState,
						idTransition, condition, option, number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionNoReturnableFromSetDataItemInSubStateToState(
			String idUID, String idSourceState, String idSourceSubState,
			String idSourceDataItem, String idTargetState, String idTransition,
			String condition, String option, int number) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromSetDataItemInSubStateToState(
						idSourceState, idSourceSubState, idSourceDataItem,
						idTargetState, idTransition, condition, option, number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	public void insertTransitionNoReturnableFromSetStructureInSubStateToState(
			String idUID, String idSourceState, String idSourceSubState,
			String idSourceStructure, String idTargetState,
			String idTransition, String condition, String option, int number) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromSetStructureInSubStateToState(
						idSourceState, idSourceSubState, idSourceStructure,
						idTargetState, idTransition, condition, option, number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	// NOVOS QUE EU FIZ... estes conectam transições a chamadas de UIDs,
	// sem considerar que estas chamadas são outros UIDS e sim somente
	// simples chamadas, como se fossem estados.

	public void insertTransitionFromStateToUIDCall(String idUID,
			String idSourceState, String idTargetUIDCall, String idTransition,
			String condition, String option) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromStateToUIDCall(idSourceState,
						idTargetUIDCall, idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionFromSubStateToUIDCall(String idUID,
			String idSourceState, String idSourceSubState,
			String idTargetUIDCall, String idTransition, String condition,
			String option) {

		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromSubStateToUIDCall(idSourceState,
						idSourceSubState, idTargetUIDCall, idTransition,
						condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionFromDataItemToUIDCall(String idUID,
			String idSourceState, String idSourceDataItem,
			String idTargetUIDCall, String idTransition, String condition,
			String option) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromDataItemToUIDCall(idSourceState,
						idSourceDataItem, idTargetUIDCall, idTransition,
						condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionFromStructureToUIDCall(String idUID,
			String idSourceState, String idSourceStructure,
			String idTargetUIDCall, String idTransition, String condition,
			String option) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromStructureToUIDCall(idSourceState,
						idSourceStructure, idTargetUIDCall, idTransition,
						condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionFromDataItemInSubStateToUIDCall(String idUID,
			String idSourceState, String idSourceSubState,
			String idSourceDataItem, String idTargetUIDCall,
			String idTransition, String condition, String option) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromDataItemInSubStateToUIDCall(
						idSourceState, idSourceSubState, idSourceDataItem,
						idTargetUIDCall, idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionFromStructureInSubStateToUIDCall(String idUID,
			String idSourceState, String idSourceSubState,
			String idSourceStructure, String idTargetUIDCall,
			String idTransition, String condition, String option) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromStructureInSubStateToUIDCall(
						idSourceState, idSourceSubState, idSourceStructure,
						idTargetUIDCall, idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	// TRANSITION NO RETURNABLE TO UIDCall

	public void insertTransitionNoReturnableFromStateToUIDCall(String idUID,
			String idSourceState, String idTargetUIDCall, String idTransition,
			String condition, String option) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromStateToUIDCall(
						idSourceState, idTargetUIDCall, idTransition,
						condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionNoReturnableFromSubStateToUIDCall(String idUID,
			String idSourceState, String idSourceSubState,
			String idTargetUIDCall, String idTransition, String condition,
			String option) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromSubStateToUIDCall(
						idSourceState, idSourceSubState, idTargetUIDCall,
						idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionNoReturnableFromDataItemToUIDCall(String idUID,
			String idSourceState, String idSourceDataItem,
			String idTargetUIDCall, String idTransition, String condition,
			String option) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromDataItemToUIDCall(
						idSourceState, idSourceDataItem, idTargetUIDCall,
						idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionNoReturnableFromStructureToUIDCall(
			String idUID, String idSourceState, String idSourceStructure,
			String idTargetUIDCall, String idTransition, String condition,
			String option) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromStructureToUIDCall(
						idSourceState, idSourceStructure, idTargetUIDCall,
						idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionNoReturnableFromDataItemInSubStateToUIDCall(
			String idUID, String idSourceState, String idSourceSubState,
			String idSourceDataItem, String idTargetUIDCall,
			String idTransition, String condition, String option) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromDataItemInSubStateToUIDCall(
						idSourceState, idSourceSubState, idSourceDataItem,
						idTargetUIDCall, idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionNoReturnableFromStructureInSubStateToUIDCall(
			String idUID, String idSourceState, String idSourceSubState,
			String idSourceStructure, String idTargetUIDCall,
			String idTransition, String condition, String option) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromStructureInSubStateToUIDCall(
						idSourceState, idSourceSubState, idSourceStructure,
						idTargetUIDCall, idTransition, condition, option);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	// TRANSITION FROM SET TO UID
	public void insertTransitionFromSetDataItemToUIDCall(String idUID,
			String idSourceState, String idSourceDataItem,
			String idTargetUIDCall, String idTransition, String condition,
			String option, int number) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromSetDataItemToUIDCall(idSourceState,
						idSourceDataItem, idTargetUIDCall, idTransition,
						condition, option, number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionFromSetStructureToUIDCall(String idUID,
			String idSourceState, String idSourceStructure,
			String idTargetUIDCall, String idTransition, String condition,
			String option, int number) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromSetStructureToUIDCall(idSourceState,
						idSourceStructure, idTargetUIDCall, idTransition,
						condition, option, number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionFromSetDataItemInSubStateToUIDCall(
			String idUID, String idSourceState, String idSourceSubState,
			String idSourceDataItem, String idTargetUIDCall,
			String idTransition, String condition, String option, int number) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromSetDataItemInSubStateToUIDCall(
						idSourceState, idSourceSubState, idSourceDataItem,
						idTargetUIDCall, idTransition, condition, option,
						number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionFromSetStructureInSubStateToUIDCall(
			String idUID, String idSourceState, String idSourceSubState,
			String idSourceStructure, String idTargetUIDCall,
			String idTransition, String condition, String option, int number) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionFromSetStructureInSubStateToUIDCall(
						idSourceState, idSourceSubState, idSourceStructure,
						idTargetUIDCall, idTransition, condition, option,
						number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	// TRANSITION NO RETURNABLE FROM SET TO UID

	public void insertTransitionNoReturnableFromSetDataItemToUIDCall(
			String idUID, String idSourceState, String idSourceDataItem,
			String idTargetUIDCall, String idTransition, String condition,
			String option, int number) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromSetDataItemToUIDCall(
						idSourceState, idSourceDataItem, idTargetUIDCall,
						idTransition, condition, option, number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionNoReturnableFromSetStructureToUIDCall(
			String idUID, String idSourceState, String idSourceStructure,
			String idTargetUIDCall, String idTransition, String condition,
			String option, int number) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromSetStructureToUIDCall(
						idSourceState, idSourceStructure, idTargetUIDCall,
						idTransition, condition, option, number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionNoReturnableFromSetDataItemInSubStateToUIDCall(
			String idUID, String idSourceState, String idSourceSubState,
			String idSourceDataItem, String idTargetUIDCall,
			String idTransition, String condition, String option, int number) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromSetDataItemInSubStateToUIDCall(
						idSourceState, idSourceSubState, idSourceDataItem,
						idTargetUIDCall, idTransition, condition, option,
						number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");
	}

	public void insertTransitionNoReturnableFromSetStructureInSubStateToUIDCall(
			String idUID, String idSourceState, String idSourceSubState,
			String idSourceStructure, String idTargetUIDCall,
			String idTransition, String condition, String option, int number) {
		UID uid;
		for (int i = 0; i < this.setUIDs.size(); i++) {
			uid = this.setUIDs.elementAt(i);
			if (uid.getId().equals(idUID)) {
				uid.insertTransitionNoReturnableFromSetStructureInSubStateToUIDCall(
						idSourceState, idSourceSubState, idSourceStructure,
						idTargetUIDCall, idTransition, condition, option,
						number);
				return;
			}
		}
		throw new UIDException(UIDException.NOT_EXISTING_UID,
				"There is no UID with this id");

	}

	// to UID
	// to UID
	// to UID
	// to UID
	// to UID
	// to UID
	// to UID
	// to UID
	// to UID
	// TRANSITION TO UID

	// ESSES SAO ANTIGOS E CONSIDERAVAM A CHAMADA DE UID COMO OUTROS UIDS,
	// O QUE CAUSAVA PROBLEMA NA DTD

	// /**
	// * Insere uma transicao, com idTransition, em um UID com idUID com origem
	// no
	// * estado idSourceState e destino no estado idTargetState.
	// */
	// public void insertTransitionFromStateToUID(String idUID,
	// String idSourceState, String idTargetUID, String idTransition,
	// String condition, String option) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idSourceState)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUID)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	//
	// if (uidSource != null && uidTarget != null) {
	// uidSource.insertTransitionFromStateToUID(idSourceState,
	// idTargetUID, idTransition, condition, option);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	// }
	//
	// public void insertTransitionFromSubStateToUid(String idUID,
	// String idSourceState, String idSourceSubState, String idTargetUid,
	// String idTransition, String condition, String option) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	// if (uidSource != null && uidTarget != null) {
	// uidSource.insertTransitionFromSubStateToUid(idSourceState,
	// idSourceSubState, idTargetUid, idTransition, condition,
	// option);
	// return;
	// }
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionFromDataItemToUid(String idUID,
	// String idSourceState, String idSourceDataItem, String idTargetUid,
	// String idTransition, String condition, String option) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	// uidSource.insertTransitionFromDataItemToUid(idSourceState,
	// idSourceDataItem, idTargetUid, idTransition, condition,
	// option);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionFromStructureToUid(String idUID,
	// String idSourceState, String idSourceStructure, String idTargetUid,
	// String idTransition, String condition, String option) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	// uidSource.insertTransitionFromStructureToUid(idSourceState,
	// idSourceStructure, idTargetUid, idTransition, condition,
	// option);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionFromDataItemInSubStateToUid(String idUID,
	// String idSourceState, String idSourceSubState,
	// String idSourceDataItem, String idTargetUid, String idTransition,
	// String condition, String option) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	// uidSource.insertTransitionFromDataItemInSubStateToUid(
	// idSourceState, idSourceSubState, idSourceDataItem,
	// idTargetUid, idTransition, condition, option);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionFromStructureInSubStateToUid(String idUID,
	// String idSourceState, String idSourceSubState,
	// String idSourceStructure, String idTargetUid, String idTransition,
	// String condition, String option) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	// uidSource.insertTransitionFromStructureInSubStateToUid(
	// idSourceState, idSourceSubState, idSourceStructure,
	// idTargetUid, idTransition, condition, option);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// // TRANSITION NO RETURNABLE TO UID
	//
	// /**
	// * Insere uma transicao, com idTransition, em um UID com idUID com origem
	// no
	// * estado idSourceState e destino no estado idTargetState.
	// */
	// public void insertTransitionNoReturnableFromStateToUid(String idUID,
	// String idSourceState, String idTargetUid, String idTransition,
	// String condition, String option) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	// uidSource.insertTransitionNoReturnableFromStateToUid(idSourceState,
	// idTargetUid, idTransition, condition, option);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	// }
	//
	// public void insertTransitionNoReturnableFromSubStateToUid(String idUID,
	// String idSourceState, String idSourceSubState, String idTargetUid,
	// String idTransition, String condition, String option) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	//
	// uidSource.insertTransitionNoReturnableFromSubStateToUid(
	// idSourceState, idSourceSubState, idTargetUid, idTransition,
	// condition, option);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionNoReturnableFromDataItemToUid(String idUID,
	// String idSourceState, String idSourceDataItem, String idTargetUid,
	// String idTransition, String condition, String option) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	// uidSource.insertTransitionNoReturnableFromDataItemToUid(
	// idSourceState, idSourceDataItem, idTargetUid, idTransition,
	// condition, option);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionNoReturnableFromStructureToUid(String idUID,
	// String idSourceState, String idSourceStructure, String idTargetUid,
	// String idTransition, String condition, String option) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	// uidSource.insertTransitionNoReturnableFromStructureToUid(
	// idSourceState, idSourceStructure, idTargetUid,
	// idTransition, condition, option);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionNoReturnableFromDataItemInSubStateToUid(
	// String idUID, String idSourceState, String idSourceSubState,
	// String idSourceDataItem, String idTargetUid, String idTransition,
	// String condition, String option) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	//
	// uidSource.insertTransitionNoReturnableFromDataItemInSubStateToUid(
	// idSourceState, idSourceSubState, idSourceDataItem,
	// idTargetUid, idTransition, condition, option);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionNoReturnableFromStructureInSubStateToUid(
	// String idUID, String idSourceState, String idSourceSubState,
	// String idSourceStructure, String idTargetUid, String idTransition,
	// String condition, String option) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	//
	// uidSource.insertTransitionNoReturnableFromStructureInSubStateToUid(
	// idSourceState, idSourceSubState, idSourceStructure,
	// idTargetUid, idTransition, condition, option);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// // TRANSITION FROM SET TO UID
	// public void insertTransitionFromSetDataItemToUid(String idUID,
	// String idSourceState, String idSourceDataItem, String idTargetUid,
	// String idTransition, String condition, String option, int number) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	// uidSource.insertTransitionFromSetDataItemToUid(idSourceState,
	// idSourceDataItem, idTargetUid, idTransition, condition,
	// option, number);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionFromSetStructureToUid(String idUID,
	// String idSourceState, String idSourceStructure, String idTargetUid,
	// String idTransition, String condition, String option, int number) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	//
	// uidSource.insertTransitionFromSetStructureToUid(idSourceState,
	// idSourceStructure, idTargetUid, idTransition, condition,
	// option, number);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionFromSetDataItemInSubStateToUid(String idUID,
	// String idSourceState, String idSourceSubState,
	// String idSourceDataItem, String idTargetUid, String idTransition,
	// String condition, String option, int number) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	// uidSource.insertTransitionFromSetDataItemInSubStateToUid(
	// idSourceState, idSourceSubState, idSourceDataItem,
	// idTargetUid, idTransition, condition, option, number);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionFromSetStructureInSubStateToUid(String idUID,
	// String idSourceState, String idSourceSubState,
	// String idSourceStructure, String idTargetUid, String idTransition,
	// String condition, String option, int number) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	//
	// uidSource.insertTransitionFromSetStructureInSubStateToUid(
	// idSourceState, idSourceSubState, idSourceStructure,
	// idTargetUid, idTransition, condition, option, number);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// // TRANSITION NO RETURNABLE FROM SET TO UID
	// public void insertTransitionNoReturnableFromSetDataItemToUid(String
	// idUID,
	// String idSourceState, String idSourceDataItem, String idTargetUid,
	// String idTransition, String condition, String option, int number) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	//
	// uidSource.insertTransitionNoReturnableFromSetDataItemToUid(
	// idSourceState, idSourceDataItem, idTargetUid, idTransition,
	// condition, option, number);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionNoReturnableFromSetStructureToUid(String
	// idUID,
	// String idSourceState, String idSourceStructure, String idTargetUid,
	// String idTransition, String condition, String option, int number) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	//
	// uidSource.insertTransitionNoReturnableFromSetStructureToUid(
	// idSourceState, idSourceStructure, idTargetUid,
	// idTransition, condition, option, number);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionNoReturnableFromSetDataItemInSubStateToUid(
	// String idUID, String idSourceState, String idSourceSubState,
	// String idSourceDataItem, String idTargetUid, String idTransition,
	// String condition, String option, int number) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	//
	// uidSource
	// .insertTransitionNoReturnableFromSetDataItemInSubStateToUid(
	// idSourceState, idSourceSubState, idSourceDataItem,
	// idTargetUid, idTransition, condition, option,
	// number);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }
	//
	// public void insertTransitionNoReturnableFromSetStructureInSubStateToUid(
	// String idUID, String idSourceState, String idSourceSubState,
	// String idSourceStructure, String idTargetUid, String idTransition,
	// String condition, String option, int number) {
	//
	// UID uidSource = null;
	// UID uidTarget = null;
	//
	// for (int i = 0; i < this.setUIDs.size(); i++) {
	//
	// if (this.setUIDs.elementAt(i).getId().equals(idUID)) {
	// uidSource = this.setUIDs.elementAt(i);
	// }
	// if (this.setUIDs.elementAt(i).getId().equals(idTargetUid)) {
	// uidTarget = this.setUIDs.elementAt(i);
	// }
	// }
	//
	// if (uidSource != null && uidTarget != null) {
	//
	// uidSource
	// .insertTransitionNoReturnableFromSetStructureInSubStateToUid(
	// idSourceState, idSourceSubState, idSourceStructure,
	// idTargetUid, idTransition, condition, option,
	// number);
	// return;
	// }
	//
	// throw new UIDException(UIDException.NOT_EXISTING_UID,
	// "There is no UID with this id");
	//
	// }

	// private static class Ids {
	//
	// private static Map<String, Integer> ids = null;
	//
	// // public Ids() {
	// static {
	// ids = new HashMap<String, Integer>();
	// ids.put("dataitem", 0);
	// ids.put("optionaldataitem", 0);
	// ids.put("dataitemset", 0);
	// ids.put("structure", 0);
	// ids.put("structureset", 0);
	// }
	//
	// protected static Integer getId(String item) {
	// ids.put(item, ids.get(item) + 1);
	// return ids.get(item);
	// }
	//
	// }

}